// main.go
package main

import (
	"flag"
	"fmt"
	"os"
	"path/filepath"
)

const description = `
全称: Print Working Directory
作用: 显示当前目录绝对路径.
语法: pwd
`

//帮助 -h --help
func usage() {
	fmt.Println("命令: ", os.Args[0])
	fmt.Print(description)
}

//返回当前的工作路径
func workingDirectory() {
	dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
	if err != nil {
		fmt.Println("执行失败:", err.Error())
	}
	fmt.Print(dir)
}

func main() {
	flag.Usage = usage
	flag.Parse()
	workingDirectory()
}
